// 文件：src/main/resources/static/user/js/modules/header.js
class HeaderSearch {
    constructor() {
        this.searchInput = document.getElementById('searchInput'); // 假设header搜索框ID
        this.bindEvents();
    }

    bindEvents() {
        // 绑定回车事件
        this.searchInput.addEventListener('keyup', (e) => {
            if (e.key === 'Enter') {
                window.dispatchEvent(new CustomEvent('searchPet', {
                    detail: { keyword: this.searchInput.value.trim() }
                }));
            }
        });
    }
}

// 初始化
document.addEventListener('DOMContentLoaded', () => {
    new HeaderSearch();
});